<html>
<body>
<script src="jquery.min.js"></script>
<h4>测试微信分享功能（仅在手机版UC浏览器下有效）</h4>
<input type="button" class="btnShareFriends" style='margin: 20px auto; width: 100%;height:50px;' value='分享给微信好友'> </input>
<br/>
<input type="button" class="btnWeixinShare" style='margin: 20px auto; width: 100%;height:50px;' value='分享到微信朋友圈'> </input>
<script type="TEXT/javascript">
    $(function () {
        if (/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))) {
            if (window.location.href.indexOf("?mobile") < 0) {

                //判断是手机端访问
                if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {

                    //判断是UC浏览器
                    if (typeof (ucweb) != "undefined") {

                        $(".btnShareFriends").click(function () {
                            var Browser = new Object();
                            Browser.ios = /iphone/.test(Browser.userAgent); //判断ios系统
                            var title = "测试分享到朋友圈";
                            var img = "";
                            var url = "http://www.baidu.com";
                            if (Browser.ios) {
                                ucbrowser.web_share(title, img, url, 'kWeixin', '', '@39yst', '');
                            } else {
                                ucweb.startRequest("shell.page_share", [title, img, url, 'WechatFriends', '', '', '']);
                            }
                        });

                        $(".btnWeixinShare").click(function () {
                            var Browser = new Object();
                            Browser.ios = /iphone/.test(Browser.userAgent); //判断ios系统
                            var title = "测试分享到朋友圈";
                            var img = "";
                            var url = "http://www.baidu.com";
                            if (Browser.ios) {
                                ucbrowser.web_share(title, img, url, 'kWeixinFriend', '', '@39yst', '');
                            } else {
                                ucweb.startRequest("shell.page_share", [title, img, url, 'WechatTimeline', '', '', '']);
                            }
                        });
                    }
                } else {
                    alert("请使用手机UC浏览器测试");
                }
            } else {
                alert("请使用手机访问测试");
            }
        }
    });
</script>
</body>
</html>